/**
 * Auteur : Dominique GUERIN
 * dominiquephDOTguerinATgmailDOT..
 * dominiqueDOTguerinATinseeDOTfr(ance)  
 * Remerciements: � Keith Brown pour ses deux livres sur la s�curit� sous Windows et ses diff�rents articles
 *                 et � Michel Barnett de Microsoft pour ses deux articles 
 *                ".NET Remoting Authentication and Authorization Sample"  et le code qui les accompagne
 *  Le code est utilisable, modifiable et redistribuable � volont� sous la condition de ne pas supprimer ces 7 lignes.
 */ 
package fr.doume.jna.authenticator;


//tomcat 5.5
//import org.apache.commons.logging.Log;
//import org.apache.commons.logging.LogFactory;

//tomcat 6
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;

import fr.doume.jna.sspi.TranslationRolesIntoSids;
import fr.doume.jna.sspi.WindowsContext;
import fr.doume.jna.authenticator.Parameters;
import fr.doume.jna.authenticator.HashMapWithTimeOut;

public class AuthenticationContext
{
  TranslationRolesIntoSids translator = null;
  Parameters p = null;
  HashMapWithTimeOut<String, WindowsContext> ctxHashMap = null;
  
  /**
  * called by SSPAuthenticator: cerate an AuthenticationContext with the parameters
  * read in context.xml. Create an instance variable of the type ConnectionPool  
  */
  public AuthenticationContext(Parameters param)
  {
     p = param;
    if (p.isAuthenticationBoundToTheTcpConnection() )
    {
      ctxHashMap = new HashMapWithTimeOut<String, WindowsContext>(p.getTimeOutNtlm());
    }

  }
  /**
  * get the current instance of TranslationRolesIntoSids(Set by SSPAuthenticator)
  * depends of the parameter <code>timelifemaprolesintosids</code>
  */
  public TranslationRolesIntoSids getTranslationRolesIntoSids() 
  {
    return translator;
  }
  
  /**
  * called by SSPAuthenticator
  */
  public void setTranslationRolesIntoSids( TranslationRolesIntoSids t)
  {
    translator = t;
  }
  
  /**
  * from the file context.xml
  */
  public Parameters getParameters()
  {
    return p;
  }
  
  public HashMapWithTimeOut<String, WindowsContext> getHashMapWithTimeOut()
  {
    return ctxHashMap;
  }
}  
